cmake_minimum_required(VERSION 4.0)
project(basec)

set(CMAKE_CXX_STANDARD 20)


## 查找 Boost 库
find_package(Boost REQUIRED COMPONENTS system)

find_package(asio CONFIG REQUIRED)

find_package(SDL2 CONFIG REQUIRED)

find_package(SDL2_image CONFIG REQUIRED)

find_package(SDL2_ttf CONFIG REQUIRED)
find_package(SDL2_mixer CONFIG REQUIRED)



# 包含目录
include_directories(${CMAKE_SOURCE_DIR}/include)


#include(FetchContent)
#FetchContent_Declare(
#        crow
#        GIT_REPOSITORY https://github.com/CrowCpp/Crow.git
#        GIT_TAG        v1.2.1  # 指定一个版本标签，例如v1.0.0
#)
#FetchContent_MakeAvailable(crow)

# 添加 Crow 子目录
add_subdirectory(crow)



add_executable(basec main.cpp
        test.h
        demotwo.cpp
        demotwo.h
        demo3.cpp
        demo3.h
        demo4.cpp
        demo4.h
        demo5.cpp
        demo6.cpp
        demo7.cpp
        demo8.cpp
#        demo9.cpp
        demo10.cpp
        demo11.cpp
        demo12.cpp
        demo13.cpp
        demo14.cpp
        demo15.cpp
#        demo16.cpp
        dem.h
        demo17.cpp
        demo18.cpp
        demo19.cpp
        demo20.cpp
        demo21.cpp
        demo22.cpp
        demo23.cpp
        demo24.cpp
        demo25.cpp
        demo26.cpp
        demo27.cpp
        demo28.cpp
        demo29.cpp
        demo30.cpp
        demo31.cpp
        demo32.cpp
        demo33.cpp
        demo34.cpp
        demo35.cpp
        demo36.cpp
        demo37.cpp
        demo38.cpp
        demo39.cpp
        demo40.cpp
        demo41.cpp
        demo42.cpp
        demo43.cpp
        demo44.cpp
        demo45.cpp
        MM.h
        demo46.cpp
        demo47.cpp
        demo48.cpp
        demo49.cpp
        demo50.cpp
        demo51.cpp
        demo52.cpp
        demo53.cpp
        demo54.cpp
        demo55.cpp
        demo56.cpp
        demo57.cpp
        demo58.cpp
        demo59.cpp
        demo60.cpp
        demo61.cpp
        demo62.cpp
        demo63.cpp
        demo64.cpp
        demo65.cpp
        demo66.cpp
        demo67.cpp
        demo68.cpp
        demo69.cpp
        demo70.cpp
        demo71.cpp
        demo74.cpp
        demo75.cpp
        demo76.cpp
        demo77.cpp
        demo78.cpp
        demo79.cpp
        demo80.cpp
        demo101.cpp
        demo101.h
        Sobj.cpp
        Sobj.h
        Swindow.cpp
        Swindow.h
        SWidget.h
        SWidget.cpp
        SButton.cpp
        SButton.h
        SLabel.cpp
        SLabel.h
        SAction.cpp
        SAction.h
        SMenu.cpp
        SMenu.h
        SActionTwo.cpp
        SActionTwo.h
        SMenuTwo.cpp
        SMenuTwo.h
        SEdit.cpp
        SEdit.h
        SPaint.cpp
        SPaint.h
)


if(WIN32)

    target_link_libraries(basec
            $<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
            $<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
            $<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>
            $<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>
            $<IF:$<TARGET_EXISTS:SDL2_mixer::SDL2_mixer>,SDL2_mixer::SDL2_mixer,SDL2_mixer::SDL2_mixer-static>
            asio::asio
            Crow::Crow
            ws2_32
            mswsock
            ${Boost_LIBRARIES})
else ()
    target_link_libraries(basec
            $<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
            $<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
            $<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>
            $<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>
            $<IF:$<TARGET_EXISTS:SDL2_mixer::SDL2_mixer>,SDL2_mixer::SDL2_mixer,SDL2_mixer::SDL2_mixer-static>
            asio::asio
            Crow::Crow
            ${Boost_LIBRARIES})
endif ()

